package com.twu.biblioteca;

import java.util.List;

/**
 * Created by sravanns on 19/06/14.
 */
public class ListMovies implements MenuAction {

        private Library library;
        private UserInterface userInterface;



        ListMovies(Library obj, UserInterface ui) {
            library = obj;
            userInterface=ui;
        }

        @Override
        public String toString() {
            return "List Movies";
        }

        @Override
        public Result performAction(String user) {
            String input = "";
            List<Movie> availableMoviess = library.getAvailableMovies();
            Result result = new Result();
            if (availableMoviess.size() == 0) {
                result.setResult("No Movies", false);
                return result;
            }

            userInterface.displayMovies(availableMoviess);

            result.setResult("listed "+availableMoviess.size()+" Movies",true);
            return result;
        }



}
